Spaces:
Running

defectgen / index.html
adarsh108's picture
Deploy DefectGen demo
55abd6b verified
Raw History Blame Contribute Delete
5.3 kB
<!doctype html>
<html lang="en">
<head>
<base target="_blank" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>DefectGen · GenAI synthetic defects for low-data defect detection</title>
<meta
name="description"
content="LoRA-tuned diffusion inpainting paints synthetic leather defects; a segmentation model trained with them runs live in your browser."
/>
<link rel="stylesheet" href="style.css" />
<script src="https://cdn.jsdelivr.net/npm/onnxruntime-web@1.31.1/dist/ort.min.js"></script>
</head>
<body>
<header class="hero">
<div class="wrap">
<p class="eyebrow">GenAI · diffusion inpainting · LoRA · defect segmentation</p>
<h1>DefectGen</h1>
<p class="lede">
A diffusion inpainting model, fine-tuned with LoRA on only a handful of real defect
photos, paints new defects onto clean leather. Those images, with automatically refined
labels, are added to the training set of a defect segmentation model, and everything is
measured on <strong>real images only</strong>.
</p>
<p class="headline" id="headline"></p>
<p class="links">
<a id="link-github" href="#" target="_blank" rel="noopener">Code &amp; method on GitHub</a>
<a id="link-lora" href="#" target="_blank" rel="noopener">15 LoRA adapters on the Hub</a>
</p>
</div>
</header>
<nav class="tabs wrap" role="tablist">
<button role="tab" aria-selected="true" data-tab="detect">Detect</button>
<button role="tab" aria-selected="false" data-tab="gallery">GenAI gallery</button>
<button role="tab" aria-selected="false" data-tab="results">Results</button>
</nav>
<main class="wrap">
<section id="tab-detect" class="tab" role="tabpanel">
<p class="note">
Pick a real test image or drop your own photo of leather. Both detectors run
<strong>in your browser</strong> (ONNX Runtime Web); nothing is uploaded anywhere.
</p>
<div class="examples">
<div id="examples" class="examples-list"></div>
<label class="drop" id="drop">
<input type="file" id="file" accept="image/*" />
<span>Drop your own image<br />or <u>choose a file</u></span>
</label>
</div>
<p class="status" id="status">Loading the two detectors…</p>
<div class="pair">
<figure>
<figcaption id="cap-real_only"></figcaption>
<canvas id="out-real_only" width="512" height="512"></canvas>
<p class="found" id="found-real_only"></p>
</figure>
<figure>
<figcaption id="cap-genai"></figcaption>
<canvas id="out-genai" width="512" height="512"></canvas>
<p class="found" id="found-genai"></p>
</figure>
</div>
<h3>About these two models</h3>
<p class="note" id="models-note"></p>
<div class="table" id="models-table"></div>
</section>
<section id="tab-gallery" class="tab" role="tabpanel" hidden>
<p class="note">
Each panel: <strong>clean leather</strong> (a real training image) ·
<strong>GenAI defect</strong> painted by that defect type's LoRA ·
<strong>label</strong> (green), computed from the pixels that actually changed. Panels are
the first accepted samples in order, not hand-picked, so weak ones (faint folds) show up
too. Live generation is not offered: one image takes minutes without a GPU.
</p>
<div id="gallery"></div>
</section>
<section id="tab-results" class="tab" role="tabpanel" hidden>
<p class="note">
Test mask mAP50 on real images only, mean ± std over 3 seeds. The amount of GenAI data is
chosen on the validation set, never on test. A gain counts only if it is larger than both
standard deviations.
</p>
<p class="headline" id="headline-full"></p>
<div class="table" id="t-main"></div>
<div class="plots" id="plots"></div>
<h3>Per defect class (test AP50)</h3>
<div class="table" id="t-per_class"></div>
<h3>Every run: validation mean · test mean ± std</h3>
<div class="table" id="t-grid"></div>
<h3>Generation: accept rate and image quality vs held-out real defects</h3>
<p class="note">
Lower KID and real-vs-fake accuracy closer to 0.5 mean "harder to tell from real".
</p>
<div class="table" id="t-generation"></div>
<h3>6 × 6 sample grids</h3>
<div class="grids" id="grids"></div>
</section>
</main>
<footer class="wrap">
<p>
Images: <a href="https://www.mvtec.com/company/research/datasets/mvtec-ad" target="_blank" rel="noopener">MVTec AD</a>
leather (Bergmann et al., CVPR 2019), CC BY-NC-SA 4.0. Generated images and models derived
from it are shared under the same non-commercial licence. Detector: Ultralytics YOLO
segmentation (AGPL-3.0). Generator: Stable Diffusion inpainting + LoRA.
</p>
</footer>
<script type="module" src="main.js"></script>
</body>
</html>