Spaces:
Paused
Paused
File size: 12,720 Bytes
c17ec01 ff50694 2fb805f ff50694 2dd0fb8 ff50694 e7dfc36 ff50694 e7dfc36 ff50694 e7dfc36 ff50694 0effcd5 d2acfa9 0effcd5 d2acfa9 0effcd5 ff50694 c17ec01 ff50694 0effcd5 7a7588e ff50694 c17ec01 |
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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css">
<title>HEL Perception & Engagement Reasoner (Weapon-Grade Demo)</title>
</head>
<body>
<div id="app">
<header>
<div class="brand">
<div class="logo" aria-hidden="true"></div>
<div>
<h1>HEL Perception & Engagement Reasoner</h1>
<div class="sub">Video → detection → expert features → aimpoint + Intensity@Target → HEL feasibility →
closed-loop tracking & dwell control</div>
</div>
</div>
<div class="status-row">
<div class="pill">
<span class="dot" id="sys-dot"></span>
<span id="sys-status">STANDBY · No video loaded</span>
</div>
<div class="pill">
<span class="kbd">Reason</span>
<span>Frame-1 inference</span>
</div>
<div class="pill">
<span class="kbd">Engage</span>
<span>Closed-loop track + dwell</span>
</div>
</div>
</header>
<div class="workspace">
<aside>
<div class="card">
<h2>Video Input</h2>
<div class="hint">Upload one video. Tab 1 uses only the first frame. Tab 2 reuses the same video for tracking
and engagement.</div>
<div class="row mt-md">
<label for="videoFile">Video file</label>
<span class="badge"><span id="videoMeta">No file</span></span>
</div>
<input id="videoFile" type="file" accept="video/*" />
<div class="mt-md">
<label>Mission Objective (optional · enables class filtering)</label>
<textarea id="missionText" rows="3"
placeholder="Optional: e.g., Detect people and vehicles; highlight hazards and key objects."></textarea>
<div class="hint mt-sm">
Mission objective is <b>optional</b>. If provided, it will be used directly as input to the detector.
If left blank, the detector will detect <b>all</b> objects without filtering.
<div class="mini mt-xs" id="hfBackendStatus">HF Backend: STANDBY</div>
</div>
</div>
<div class="btnrow">
<button id="btnLoadSample" class="btn secondary" title="Optional: wire up sample videos later" disabled>Load
Sample</button>
<button id="btnEject" class="btn danger" title="Unload video">Eject</button>
</div>
<div class="grid2">
<div>
<label>Detector</label>
<select id="detectorSelect">
<optgroup label="Object Detection Models">
<option value="hf_yolov8" data-kind="object" selected>Lite</option>
<option value="detr_resnet50" data-kind="object">Big</option>
<option value="grounding_dino" data-kind="object">Large</option>
</optgroup>
<optgroup label="Segmentation Models">
<option value="sam3" data-kind="segmentation">Segmentor</option>
</optgroup>
<optgroup label="Drone Detection Models">
<option value="drone_yolo" data-kind="drone">Drone</option>
</optgroup>
</select>
</div>
<div>
<label>Tracking</label>
<select id="trackerSelect">
<option value="iou">IOU + velocity (built-in)</option>
<option value="external">External hook (user API)</option>
</select>
</div>
<label class="checkbox-row" for="enableDepthToggle">
<input type="checkbox" id="enableDepthToggle">
<span>Enable Legacy Depth Map (Slow)</span>
</label>
<label class="checkbox-row" for="enableGPTToggle" style="margin-top: 4px;">
<input type="checkbox" id="enableGPTToggle" checked>
<span style="color: var(--accent-light);">Enable GPT Reasoning</span>
</label>
<label class="checkbox-row" for="enableStreamToggle" style="margin-top: 4px;">
<input type="checkbox" id="enableStreamToggle" checked>
<span>Enable Stream Processing</span>
</label>
</div>
</div>
<div class="card" style="flex:1; min-height:0">
<h2>System Log</h2>
<div class="log" id="sysLog"></div>
</div>
</aside>
<main>
<div class="tabs">
<button class="tabbtn active" data-tab="frame">Tab 1 · Frame-1 Reason</button>
<button class="tabbtn" data-tab="engage">Tab 2 · Video Engage</button>
</div>
<!-- ===== Tab 1 ===== -->
<section class="tab active" id="tab-frame">
<div class="frame-grid">
<div class="panel panel-monitor">
<h3>
<span>First Frame · Detection + Aimpoints</span>
<span class="rightnote" id="frameNote">Awaiting video</span>
</h3>
<div class="viewbox" id="frameViewBox">
<canvas id="frameCanvas" width="1280" height="720"></canvas>
<canvas id="frameOverlay" class="overlay" width="1280" height="720"></canvas>
<div class="watermark">EO/IR · Track-ID · Aimpoint · Required Dwell</div>
<div class="empty" id="frameEmpty">
<div class="big">Upload a video to begin</div>
<div class="small">This demo performs first-frame perception and engagement reasoning. Then it replays
the same video with closed-loop tracking and dynamic dwell updates.</div>
<div style="display:flex; gap:10px; margin-top:6px; flex-wrap:wrap; justify-content:center;">
<span class="badge"><span class="dot"></span> If you are online, COCO-SSD loads automatically</span>
</div>
</div>
</div>
<div class="btnrow" style="margin-top:10px">
<button id="btnReason" class="btn">Reason</button>
<button id="btnCancelReason" class="btn danger" style="display: none;">Cancel</button>
<button id="btnRecompute" class="btn secondary">Recompute HEL</button>
<button id="btnClear" class="btn secondary">Clear</button>
</div>
<div class="strip mt-md">
<span class="chip" id="chipFrameDepth"
title="Toggle depth view of first frame (if available)">VIEW:DEFAULT</span>
</div>
</div>
<div class="panel panel-summary" style="display:flex; flex-direction:column; min-height: 0; overflow: hidden;">
<h3>
<span>Object Track Cards</span>
<span class="rightnote" id="trackCount">0</span>
</h3>
<div class="list" id="frameTrackList" style="flex:1; overflow-y:auto; padding:6px; max-height:none;">
<!-- Cards injected here -->
<div style="font-style:italic; color:var(--faint); text-align:center; margin-top:20px; font-size:12px;">
No objects tracked.
</div>
</div>
</div>
<!-- Threat Chat Panel -->
<div class="panel panel-chat" id="chatPanel">
<h3>
<span>Threat Analyst Chat</span>
<button class="collapse-btn" id="chatToggle" style="font-size: 0.75rem;">▲ Close Chat</button>
</h3>
<div class="chat-container">
<div class="chat-messages" id="chatMessages">
<div class="chat-message chat-system">
<span class="chat-icon">SYS</span>
<span class="chat-content">Run detection first, then ask questions about detected threats.</span>
</div>
</div>
<div class="chat-input-row">
<input type="text" id="chatInput" placeholder="Ask about threats..." autocomplete="off">
<button id="chatSend" class="btn">Send</button>
</div>
</div>
</div>
</div>
</section>
<!-- ===== Tab 2 ===== -->
<section class="tab" id="tab-engage">
<div class="engage-grid">
<div class="panel">
<h3>
<span>Video Engage · Tracking + Dynamic Dwell</span>
<div style="display: flex; gap: 8px; align-items: center;">
<button class="collapse-btn" id="btnToggleSidebar">◀ Hide Sidebar</button>
<span class="rightnote" id="engageNote">Awaiting video</span>
</div>
</h3>
<div class="viewbox" style="min-height: 420px;">
<video id="videoEngage" playsinline muted></video>
<canvas id="engageOverlay" class="overlay"></canvas>
<div class="watermark">LOCK · DIST · DWELL · AIMPOINT · FIRE/ASSESS</div>
<div class="empty" id="engageEmpty">
<div class="big">No video loaded</div>
<div class="small">Upload a video. Run <b>Reason</b> first to initialize aimpoints and baseline dwell.
Then click <b>Engage</b>.</div>
</div>
</div>
<div class="btnrow mt-md">
<button id="btnEngage" class="btn">Engage</button>
<button id="btnPause" class="btn secondary">Pause</button>
<button id="btnReset" class="btn secondary">Reset</button>
</div>
<div class="strip mt-md">
<span class="chip" id="chipPolicy">POLICY:AUTO</span>
<span class="chip" id="chipTracks">TRACKS:0</span>
<span class="chip" id="chipBeam">BEAM:OFF</span>
<span class="chip" id="chipHz">DET:6Hz</span>
<span class="chip" id="chipFeed" title="Toggle raw vs HF-processed feed (if available)">FEED:RAW</span>
<span class="chip" id="chipDepth" title="Toggle depth view (if available)">VIEW:DEFAULT</span>
</div>
<div class="mt-md">
<div class="row"><label>Active dwell progress (selected)</label><small class="mini"
id="dwellText">—</small>
</div>
<div class="bar">
<div id="dwellBar"></div>
</div>
</div>
<div class="hint mt-md">Manual targeting: choose “Manual” in Engagement Policy, then
click a target in the video. The “beam” will track its aimpoint and accumulate dwell.</div>
</div>
<div class="engage-right">
<div class="panel" style="flex:1; min-height:0">
<h3>
<span>Live Track Cards</span>
<span class="rightnote" id="liveStamp">—</span>
</h3>
<div class="list" id="trackList" style="max-height:none"></div>
</div>
</div>
</div>
</section>
</div>
<footer>
<div>Demo mode · Unclassified visuals · Integrate your APIs where marked</div>
<div class="mono" id="telemetry">HEL=60kW · VIS=16km · Cn²=5/10 · AO=7/10 · DET=6Hz</div>
</footer>
<!-- Hidden video used only for first-frame capture -->
<video id="videoHidden" playsinline muted style="display:none"></video>
</div>
<script>
window.API_CONFIG = {
BACKEND_BASE: "https://biaslab2025-perception.hf.space"
};
</script>
<script src="./js/init.js"></script>
<script src="./js/core/config.js"></script>
<script src="./js/core/utils.js"></script>
<script src="./js/core/state.js"></script>
<script src="./js/core/physics.js"></script>
<script src="./js/core/video.js"></script>
<script src="./js/core/hel.js"></script>
<script src="./js/ui/logging.js"></script>
<script src="./js/core/tracker.js"></script>
<script src="./js/api/client.js"></script>
<script src="./js/ui/overlays.js"></script>
<script src="./js/ui/cards.js"></script>
<script src="./js/ui/features.js"></script>
<script src="./js/ui/cursor.js"></script>
<script src="./js/ui/chat.js"></script>
<script src="./data/helicopter_demo_data.js"></script>
<script src="./js/core/demo.js"></script>
<script src="./js/main.js"></script>
</body>
</html> |