File size: 5,750 Bytes
3f61164 402e874 | 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 | <!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PatchCore – détection de défauts industriels</title>
<style>
:root { --navy:#0B3C49; --teal:#0F7B73; --orange:#E8A33D; --red:#C8501E; --card:#E8F0F2; --ink:#1c2b30; }
* { box-sizing: border-box; }
body { margin:0; font-family: Calibri, "Segoe UI", system-ui, sans-serif; color:var(--ink); background:#f5f8f9; }
header { background:var(--navy); color:white; padding:22px 32px 18px; }
header h1 { margin:0 0 6px; font-family: Cambria, Georgia, serif; font-size:1.7em; font-weight:700; }
header p { margin:0; opacity:.88; max-width:980px; line-height:1.45; }
header a { color:var(--orange); }
main { display:grid; grid-template-columns: minmax(300px, 1fr) 2fr; gap:24px; padding:24px 32px; max-width:1400px; }
@media (max-width: 900px) { main { grid-template-columns: 1fr; padding:16px; } }
.panel { background:white; border-radius:12px; padding:18px; box-shadow:0 1px 3px rgba(0,0,0,.08); }
h2 { font-family: Cambria, Georgia, serif; color:var(--navy); font-size:1.1em; margin:0 0 10px; }
#drop { border:2px dashed #9bb7bd; border-radius:10px; min-height:230px; display:flex; align-items:center;
justify-content:center; text-align:center; cursor:pointer; color:#5b7378; background:var(--card); overflow:hidden; }
#drop.over { border-color:var(--teal); background:#d6ebe8; }
#drop img { max-width:100%; max-height:300px; display:block; }
label { display:block; font-weight:600; margin:14px 0 6px; }
select { width:100%; padding:9px; font-size:1em; border-radius:8px; border:1px solid #b9cbd0; }
button#run { margin-top:14px; width:100%; padding:12px; font-size:1.1em; font-weight:700; border:0; border-radius:8px;
background:var(--orange); color:var(--navy); cursor:pointer; }
button#run:disabled { opacity:.5; cursor:wait; }
#examples { display:grid; grid-template-columns: repeat(4, 1fr); gap:8px; }
#examples figure { margin:0; cursor:pointer; border-radius:8px; overflow:hidden; border:2px solid transparent; background:var(--card); }
#examples figure:hover { border-color:var(--teal); }
#examples img { width:100%; display:block; aspect-ratio:1; object-fit:cover; }
#examples figcaption { font-size:.72em; padding:3px 5px; color:#36505a; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#status { font-size:.9em; color:#4d6a70; margin-top:10px; min-height:1.3em; }
.bar { height:6px; background:#dbe6e8; border-radius:3px; overflow:hidden; margin-top:6px; display:none; }
.bar > div { height:100%; width:0; background:var(--teal); transition:width .2s; }
#verdict { border-radius:10px; padding:14px 18px; font-size:1.5em; font-weight:700; text-align:center; color:white;
background:#9fb3b8; }
#verdict small { font-weight:400; font-size:.65em; }
.outs { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:16px; }
.outs figure { margin:0; }
.outs figcaption { font-weight:600; color:var(--navy); margin-bottom:6px; }
.outs canvas { width:100%; aspect-ratio:1; border-radius:8px; background:var(--card); image-rendering:auto; }
#info { margin-top:14px; line-height:1.6; }
.scale { display:flex; align-items:center; gap:8px; font-size:.8em; color:#4d6a70; margin-top:4px; }
.scale span.g { flex:1; height:10px; border-radius:5px;
background:linear-gradient(90deg,#00007f,#0000ff,#007fff,#00ffff,#7fff7f,#ffff00,#ff7f00,#ff0000,#7f0000); }
footer { padding:0 32px 28px; font-size:.85em; color:#5b7378; max-width:1400px; }
</style>
</head>
<body>
<header>
<h1>Détection et localisation de défauts industriels — PatchCore</h1>
<p>Le modèle n'a vu <b>que des pièces conformes</b> pendant l'apprentissage. Chaque patch de l'image est comparé à une
banque mémoire de patchs normaux ; les patchs trop éloignés sont signalés comme anomalies.
L'inférence tourne <b>entièrement dans votre navigateur</b> (ONNX Runtime Web, aucun serveur).
Code, modèles et résultats : <a id="repo" href="https://huggingface.co/salimamri9/patchcore-mvtec-cpu" target="_blank">salimamri9/patchcore-mvtec-cpu</a></p>
</header>
<main>
<section class="panel">
<h2>1. Image d'entrée</h2>
<div id="drop" tabindex="0">Déposez une image ici<br>ou cliquez pour en choisir une</div>
<input type="file" id="file" accept="image/*" hidden>
<label for="cat">2. Catégorie (modèle)</label>
<select id="cat"></select>
<button id="run" disabled>Analyser</button>
<div id="status">Chargement…</div>
<div class="bar" id="bar"><div></div></div>
<h2 style="margin-top:20px">Exemples (MVTec AD, jeu de test)</h2>
<div id="examples"></div>
</section>
<section class="panel">
<div id="verdict">En attente d'une image</div>
<div class="outs">
<figure><figcaption>Carte d'anomalie</figcaption><canvas id="heat" width="224" height="224"></canvas>
<div class="scale">0.5 × seuil <span class="g"></span> 1.5 × seuil</div></figure>
<figure><figcaption>Défaut segmenté</figcaption><canvas id="seg" width="224" height="224"></canvas></figure>
</div>
<div id="info"></div>
</section>
</main>
<footer>
Données : MVTec AD (Bergmann et al.), licence CC BY-NC-SA 4.0. Méthode : Roth et al., <i>Towards Total Recall in
Industrial Anomaly Detection</i>, CVPR 2022 — réimplémentation, calibration du seuil et export ONNX par le groupe.
Extracteur Wide-ResNet-50-2 (ImageNet), coreset 1 %. Premier chargement : ~100 Mo (mis en cache ensuite).
</footer>
<script src="https://cdn.jsdelivr.net/npm/onnxruntime-web@1.31.1/dist/ort.min.js"></script>
<script src="app.js"></script>
</body>
</html>
|