MVTec AD bir benchmark'tır, veri seti değildir
Her anomali tespit makalesi MVTec AD'de %99 image-AUROC'a yakın çıkar. Bu sayı, ekiplerin güvenle bir modeli dağıtıp sonra üretimde başarısız olduğunu izlemesinin nedenidir. MVTec AD küçüktür (~5k görüntü), tertemizdir (lab aydınlatması, temiz arka planlar, tek nesne) ve küratördür (anomaliler bir insana <1 sn'de görünür). Fabrika zemininiz bunlardan hiçbiri değildir.Kendi veri setinizi topluyorsanız, zorlu yoldan öğrendiklerimiz şu.
Sınıf dengesizliği bütün problemdir
Anomaliler tanım gereği nadirdir. %1 kusur oranı üreten bir hat tipik bir haftada size yüz kadar anomali ve on binlerce iyi parça verir. Bu "loss'u dengele" problemi değildir. "Asla denetimli öğrenme için yeterli anomaliniz yok" problemidir. Bu yüzden denetimsiz yöntemler.Ama: o %1 belki yirmi farklı kusur türü içerir. Sahip olduğunuz veride eğitirseniz, yaygın kusurları iyi kapsar ve nadir olanları kaçırırsınız — nadir olanlar elbette kaçırması en pahalı olanlardır.
Cold start problemi
Bir projenin ilk gününde ne iyi görüntülere ne anomali görüntülere sahipsiniz. İki hafta veri toplama sonrası, birkaç yüz iyi görüntü ve sıfır onaylı anomali var. Karar: "sadece iyi" anomali dedektörünü şimdi dağıtıp ne işaretlediğini öğrenmek mi, yoksa birkaç onaylı anomali çıkana kadar beklemek mi?Şuna yakınsadık: 2. hafta sonunda gölge modda dağıt. Operatörün manuel reddetmelerini anomali etiketleri olarak kullan. Onları incelemeden etiketlere güvenme.
Gerçekten işe yarayan aktif öğrenme döngüleri
- Her parçada inference çalıştır. Skor + görüntü logla.
- İnsan incelemeci kuyrukları: en yüksek skorlu iyi parçalar (potansiyel false reject), en düşük skorlu kötü parçalar (potansiyel false accept).
- Operatör görüntü başına <30 sn'de, bunun için inşa edilmiş bir UI'da etiketler. Bir excel değil.
- Günlük delta: 50-100 yeni etiket, kümülatif sette haftalık yeniden eğitim.
Bu desen, en kötü performans gösteren projemizi altı haftalık üretimde %92'den %99.4 image-AUROC'a taşıdı. Yeni model mimarisi değil; sadece daha iyi bir veri seti.
Sentetik anomaliler (CutPaste, DRAEM)
Şaşırtıcı derecede güçlü bir araç. İşin püf noktası: aynı görüntüden rastgele crop'lar yapıştır (CutPaste) veya Perlin gürültü tabanlı yapısal anomaliler simüle et (DRAEM-tarzı). Model "bu bölge istatistiksel olarak tutarsız" öğrenir, "bu gördüğüm anomalilere benziyor" değil. Saf denetimli yaklaşımlardan görülmemiş kusur türlerine daha iyi genelleşir.Sadece sentetik modeller göndermiyoruz. Gerçek iyi numuneler + sentetik bozulmalar üzerinde eğitilmiş modeller gönderiyoruz.
Görüntünün ötesinde gerçekten yakalanması gerekenler
- Kamera ID, lens config, aydınlatma durumu — farklı kameralar farklı drift eder.
- Vardiya, operatör ID, hat hızı — operatör odaklı varyans gerçek bir sinyaldir.
- Mevcutsa upstream süreç değişkenleri (sıcaklık, basınç) — bazen anomali upstream'dir.
- Malzeme lot — farklı tedarikçi batch'leri kameraya farklı görünür.
Bunlar, üç ay sonra karmaşa matrisine bakmak yerine bir regresyonu hata ayıklamanıza izin veren kolonlardır.
Son bir şey
Eğitim görüntülerinizi sıkıştırmayın. Kayıplı JPEG sıkıştırması tam olarak tespit etmeye çalıştığınız düşük genlikli kusurları gizler. Ham PNG'leri soğuk depoda tutun, modelin gerektiriyorsa eğitim zamanında downsample edin.Veri seti sıklığınız nedir? Haftalık yeniden eğitim, aylık, sadece talep üzerine?
MVTec AD is a benchmark, not a dataset
Every anomaly detection paper tops out near 99 % image-AUROC on MVTec AD. That number is the reason teams confidently deploy a model and then watch it fail in production. MVTec AD is small (~5k images), pristine (lab lighting, clean backgrounds, single object), and curated (anomalies are visible to a human in <1 s). Your factory floor is none of those things.If you're collecting your own dataset, here's what we've learned the hard way.
Class imbalance is the whole problem
Anomalies are rare by definition. A line that produces 1 % defect rate gives you, in a typical week, a hundred or so anomalies and tens of thousands of good parts. This isn't a "balance the loss" problem. It's a "you don't have enough anomalies for supervised learning, ever" problem. Hence unsupervised methods.But: that 1 % includes maybe twenty distinct defect types. If you train on the data you have, you'll cover the common defects fine and miss the rare ones — the rare ones being, of course, the most expensive ones to miss.
The cold start problem
On day one of a project you have no good images and no anomaly images. Two weeks of data collection later, you have a few hundred good images and zero confirmed anomalies. The decision: deploy a "good only" anomaly detector now and find out what it flags, or wait until a couple of confirmed anomalies show up?We've converged on: deploy in shadow mode at the end of week 2. Use the operator's manual rejections as anomaly labels. Don't trust the labels until you've reviewed them.
Active learning loops that actually work
- Run inference on every part. Log score + image.
- Human reviewer queues: highest-score good parts (potential false rejects), lowest-score bad parts (potential false accepts).
- Operator labels in <30 s per image, in a UI built for it. Not a spreadsheet.
- Daily delta: 50-100 new labels, weekly retrain on the cumulative set.
This is the pattern that took our worst-performing project from 92 % to 99.4 % image-AUROC over six weeks of production. No new model architecture; just a better dataset.
Synthetic anomalies (CutPaste, DRAEM)
A surprisingly strong tool. The trick: paste random crops from the same image (CutPaste) or simulate Perlin-noise-driven structural anomalies (DRAEM-style). The model learns "this region is statistically inconsistent" rather than "this looks like the anomalies I've seen". Generalises better to unseen defect types than naive supervised approaches.We don't ship synthetic-only models. We ship models trained on real good samples + synthetic perturbations.
Things to actually capture, beyond the image
- Camera ID, lens config, lighting state — different cameras drift differently.
- Shift, operator ID, line speed — operator-driven variance is a real signal.
- Upstream process variables (temperature, pressure) when available — sometimes the anomaly is upstream.
- Material lot — different supplier batches look different to the camera.
These are the columns that let you debug a regression three months later instead of staring at a confusion matrix.
One last thing
Don't compress your training images. Lossy JPEG compression hides exactly the kind of low-amplitude defects you're trying to detect. Keep the raw PNGs in cold storage, downsample at training time if the model needs it.What's your dataset cadence? Weekly retrain, monthly, on-demand only?