Topic1APOD / index.html
miyuki17's picture
Expand COCO classroom example bank to 100 images
330fbdb verified
Raw History Blame Contribute Delete
9.68 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="description"
content="AI-Powered Object Detection mini-lab using COCO examples and a pretrained model"
/>
<title>AI-Powered Object Detection</title>
<link
rel="icon"
href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🔎</text></svg>"
/>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<main class="page-shell">
<nav class="guide-linkbar" aria-label="Course guide">
<span>Building your own AI mini app?</span>
<a href="./how-to-start.html">How to Start <span aria-hidden="true">→</span></a>
</nav>
<!-- =========================================================
HERO
========================================================== -->
<header class="hero">
<p class="eyebrow">
Creative Technology · Computer Vision
</p>
<h1>
AI-Powered<br />
Object Detection
</h1>
<p class="lede">
Pick a COCO example or upload your own image.
Then choose a pretrained detector and let AI answer:
<strong>
what objects are here, and where are they?
</strong>
</p>
<div
class="lesson-strip"
aria-label="Mini-lab overview"
>
<span>
<b>Task</b>
Object detection
</span>
<span>
<b>Data</b>
COCO validation examples
</span>
<span>
<b>Models</b>
RT-DETR · DETR · YOLOS Tiny
</span>
</div>
</header>
<!-- =========================================================
MAIN WORKSPACE
========================================================== -->
<section
class="workspace"
aria-label="Object detection mini-lab"
>
<!-- =======================================================
LEFT: CONTROLS
======================================================== -->
<div class="controls card">
<!-- STEP 1 -->
<div class="step">
<span class="step-number">
1
</span>
<div>
<p class="control-label sample-title">
Choose an image
</p>
<p class="helper">
Start with a tested COCO example,
or try a photo of your own.
</p>
</div>
</div>
<!-- COCO EXAMPLES -->
<div class="sample-head coco-head">
<div>
<p class="input-kicker">
Start here · COCO examples
</p>
<p class="helper">
Four images are drawn at random
from 100 bundled COCO validation examples.
</p>
</div>
<button
id="shuffle-examples"
class="shuffle-button"
type="button"
>
Shuffle
</button>
</div>
<div
id="sample-grid"
class="sample-grid"
aria-label="COCO example images"
></div>
<!-- OR -->
<div class="or-row">
<span>
or try your own
</span>
</div>
<!-- IMAGE UPLOAD -->
<label
class="control-label"
for="image-input"
>
Upload an image
</label>
<p class="helper">
Useful for seeing where the model
generalizes well—and where it does not.
</p>
<input
id="image-input"
class="file-input"
type="file"
accept="image/*"
/>
<div class="divider"></div>
<!-- STEP 2 -->
<div class="step">
<span class="step-number">
2
</span>
<div class="grow">
<label
class="control-label"
for="model-select"
>
Choose detector
</label>
<select
id="model-select"
class="model-select"
></select>
<p
id="model-note"
class="helper"
>
RT-DETR is the recommended classroom default.
</p>
</div>
</div>
<div class="divider"></div>
<!-- STEP 3 -->
<div class="step">
<span class="step-number">
3
</span>
<div class="grow">
<div class="slider-row">
<label
class="control-label"
for="threshold"
>
Confidence threshold
</label>
<output
id="threshold-value"
for="threshold"
>
0.50
</output>
</div>
<input
id="threshold"
type="range"
min="0.10"
max="0.95"
value="0.50"
step="0.05"
/>
<p class="helper">
Higher values only keep predictions
the model is more confident about.
</p>
</div>
</div>
<!-- RUN BUTTON -->
<button
id="run-button"
class="run-button"
type="button"
disabled
>
Run AI Detection
</button>
<!-- STATUS -->
<p
id="status"
class="status"
aria-live="polite"
>
Choose a COCO example or upload your own image.
</p>
<!-- PROGRESS -->
<div
id="progress-wrap"
class="progress-wrap"
hidden
>
<div
id="progress-bar"
class="progress-bar"
></div>
</div>
</div>
<!-- =======================================================
RIGHT: RESULT
======================================================== -->
<div class="result card">
<div class="result-head">
<div>
<p class="section-kicker">
AI prediction
</p>
<h2>
What did the detector find?
</h2>
</div>
<span
id="runtime-badge"
class="badge"
>
Waiting
</span>
</div>
<!-- RESULT CANVAS -->
<div
id="canvas-wrap"
class="canvas-wrap empty"
>
<canvas
id="result-canvas"
aria-label="Detection result"
></canvas>
<p id="canvas-placeholder">
Choose an image first.
The original image appears here before detection.
</p>
</div>
<!-- SUMMARY -->
<div
id="summary"
class="summary"
>
No detections yet.
</div>
<!-- DETECTION TABLE -->
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Object</th>
<th>Confidence</th>
<th>Bounding box</th>
</tr>
</thead>
<tbody id="detections-body">
<tr class="empty-row">
<td colspan="3">
Run the detector to see details.
</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<!-- =========================================================
EXPLANATION
========================================================== -->
<section class="explain card">
<p class="section-kicker">
What you are doing
</p>
<h2 class="explain-title">
Use a learned AI capability instead of rebuilding
the traditional task from scratch.
</h2>
<p class="explain-copy">
COCO contains everyday-object images with annotations.
The selected pretrained detector has already learned
the object-detection task from labeled data.
In this mini-lab, you can switch models and compare
how their predictions differ on the same image.
</p>
<div
class="flow"
aria-label="Object detection flow"
>
<span>
COCO example or your image
</span>
<span class="arrow">
→
</span>
<span>
Selected pretrained detector
</span>
<span class="arrow">
→
</span>
<span>
Boxes + labels + confidence
</span>
</div>
<p class="extension-note">
<strong>
Compare models:
</strong>
keep the image fixed,
switch detector,
and observe how predictions,
confidence,
and speed change.
</p>
</section>
<!-- =========================================================
FOOTER
========================================================== -->
<footer>
Hosted as a Hugging Face Static Space ·
Powered by Transformers.js
</footer>
</main>
<!-- ===========================================================
APP
============================================================ -->
<script
type="module"
src="./app.js"
></script>
</body>
</html>