A common way to find defects without pixel labels is to "repair" the image. A translation network turns a defective photo of a surface into a defect-free version, often called a golden template, and the pixels that changed are flagged as defects. The weak point is that the repair network is trained with a round-trip rule: a second network must rebuild the original defective image from the clean one. A network trained this way can satisfy the rule by cheating. It hides a faint, invisible copy of the defect inside the "clean" image, and the second network learns to read that hidden copy. Whatever the repair network hides, it does not remove, so the hidden defect drops out of the difference map and is missed.
We propose to block that hidden route and open a legitimate one. Between the two networks we place a lossy channel (small random noise, JPEG compression), which is known to destroy hidden signals. Next to the clean image we pass an explicit, size-penalized defect mask, and the original pixels are visible only inside it. The rebuilding network can then recover the defect only if the mask covers it, so the mask becomes the detector. It is defined as the smallest region that a normal-looking image cannot explain. A handful of labeled examples of known defect types supervise the same mask and set its decision threshold. Defect types never seen in training are still caught by the unsupervised round-trip pressure. This is a hybrid detector in the sense of combining supervised and unsupervised signals, but both signals act on one output rather than being fused after the fact.
Core Claim
Our claim is that hidden-signal cheating is a measurable cause of missed defects in golden-template inspection. We also claim that making the round trip lossy, together with a sparse mask route, improves pixel-level localization on complex and non-rigid textures. The gain should be largest on defect types that are absent from the labeled set.
Grounding in Prior Work
The cheating mechanism comes from CycleGAN, a Master of Steganography. That paper showed that cycle-consistent translators between domains of unequal detail hide source information as low-amplitude, high-frequency patterns. It also showed that noise of amplitude 3/256, or JPEG compression of the intermediate image, breaks the reconstruction. The paper is purely diagnostic and never examines defect detection. We reuse its perturbations as a training-time channel rather than as a probe.
Two lines of work supply the setting we target, and both use the template-difference recipe without testing for hidden channels. Weakly-Supervised Defect Segmentation on Periodic Textures Using CycleGAN trains a CycleGAN with an identity loss to produce golden templates and subtracts them patch-wise. It works on rigid wafer grids but collapses on the non-rigid TILDA textiles. When Textures Deceive: Weakly Supervised Industrial Anomaly Detection with Adapted-Loss CycleGAN (AL-CycleGAN) changes the discriminator loss to a high power so that busy machining textures are not mistaken for defects. Its authors leave hybrid supervision and robustness to hidden signals open.
The closest design relative is pathology factorization. Adversarial Pseudo Healthy Synthesis Needs Pathology Factorization and Pseudo-healthy synthesis with pathology disentanglement and adversarial learning split a diseased brain scan into a pseudo-healthy image plus a lesion mask, then recombine the two. Their motivation is exactly that vanilla CycleGAN hides lesions as noise. Their reconstructor, however, still receives the pseudo-healthy image losslessly, so a hidden channel remains available, and the mask is trained adversarially rather than by an explicit rate penalty. Our proposal differs from theirs on three points: the lossy channel, the rule that original pixels pass only through the mask, and supervision of the mask with known defect types on industrial textures.
Diffusion Models for Counterfactual Generation and Anomaly Detection in Brain Images (Dif-fuse) works differently. A classifier first produces a saliency map, and a diffusion model (a generator that learns by gradually denoising random noise into samples) then repaints only that region. This is the constraining case for our design. If the classifier misses a new defect, Dif-fuse never repaints it, and iterative sampling cannot match factory speed.
The hybrid-detection literature constrains the design in two further ways. MVTec AD - A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection documents that reconstruction models often rebuild anomalies too well. It also documents that choosing a threshold from normal data alone is ill-posed. Semi-Supervised Isolation Forest for Anomaly Detection and FusedVision show that a few labels can sharpen an unsupervised detector. FusedVision's supervised branch is limited to object classes and cannot represent cracks or scratches. Our supervised signal therefore acts on a pixel mask, which has no fixed vocabulary.
Research Program
The generator $G$ maps an input image $x$ to a template $t$ and a soft mask $m \in [0,1]$ per pixel. The reconstructor $R$ sees two things: a corrupted template $C(t)$, where $C$ applies random Gaussian noise and JPEG compression at a randomly drawn quality, and the masked original $m \odot x$. Training minimizes
$$ \mathcal{L} = \lVert R(C(t),\, m \odot x) - x \rVert_1 + \lambda \lVert m \rVert_1 + \mathcal{L}_{\text{adv}}(t) + \mathcal{L}_{\text{normal}} + \beta\, \mathcal{L}_{\text{sup}}(m). $$
The terms do the following:
- The first term asks $R$ to rebuild the input.
- The second term, weighted by $\lambda$, charges for mask area.
- $\mathcal{L}_{\text{adv}}$ is a discriminator loss that forces $t$ to look like normal images. We use the AL-CycleGAN power loss so that textured backgrounds are not penalized.
- $\mathcal{L}_{\text{normal}}$ asks that on normal images $m$ is empty and $t \approx x$.
- $\mathcal{L}_{\text{sup}}$ is a pixel loss on the few images of known defect types that carry masks, with weight $\beta$.
Because $C$ removes the faint high-frequency route, defect detail can reach $R$ cheaply only through the mask. The area penalty keeps the mask from covering everything.
The channel strength has to be chosen with care. If it is too strong, it erases legitimate fine texture, and $R$ is pushed to open the mask over normal texture. We will sweep the noise amplitude around the 3/256 level reported by Chu et al. and measure false-positive mask area on normal images. The labeled known-defect images play a second role: they are used to pick the mask threshold. This replaces the ill-posed normal-only thresholding criticized in the MVTec AD paper.
Baselines
The naive reference is the golden-template recipe of Kim et al. That is a CycleGAN with identity loss and patch-wise absolute difference, retrained by us on every benchmark. On their private wafer data it reached 82.33% mean intersection-over-union (mIoU), against 86.15% for a fully supervised segmenter. On TILDA it reached only 12–14% mIoU. Beating it means a clear mIoU gain on TILDA, where it fails.
The strongest existing method on complex textures is AL-CycleGAN. On MCBT, the Manufacturing Complex Background Texture benchmark introduced by the AL-CycleGAN paper, it reports 1.0 image-level AUROC and 0.929 pixel-level AUROC at 496 frames per second. Image AUROC is saturated there, so we compete on pixel-level AUROC, the per-region overlap (PRO) score, and held-out defect types. Beating it means exceeding 0.929 pixel-level AUROC on MCBT under our reproduction, and winning on held-out types on MVTec AD, at comparable throughput.
The file also lists SimpleNet and DRAEM as baselines that were compared on MCBT. No reported result was found on Lacuna for SimpleNet or DRAEM on MCBT, so we will run them ourselves.
Two baselines target the hybrid claim specifically:
- Supervised-only segmenter. A segmenter trained only on the labeled known defect types, with the same backbone as our mask head.
- Late fusion. That segmenter averaged with AL-CycleGAN's difference map, in the style of FusedVision's merging.
For the factorization relative, we will run the Xia-style decomposition without our lossy channel. For Dif-fuse, the only reported numbers in the file are on brain data: 0.699 Dice on BraTS 2021 and 0.569 Dice on WMH. We will compare against it only in the optional medical arm.
All methods share the training images, label budget, input resolution, number of epochs, and a fixed budget of twenty hyperparameter trials, tuned on the same validation split.
The key ablations remove one ingredient at a time:
- the lossy channel only (AL-CycleGAN trained with $C$);
- the mask route without the channel;
- the mask route without the supervised term.
Why not just…?
Why not just add noise and JPEG augmentation to AL-CycleGAN? This is the real threat. It is one line of code, and it might remove most of the cheating by itself. Without a mask route, though, the reconstructor facing a defective input has no legitimate source for defect detail. The generator may then leave the defect visibly in the template, which also lowers the difference signal. Alternatively, training may become unstable. The "channel-only" ablation settles the question. If it matches the full method on pixel-level AUROC, PRO, and held-out types, we will report the simpler method as the contribution and drop the mask.
Why not just use the pathology-factorization model as is? It already has a mask, but its reconstructor reads the pseudo-healthy image losslessly. The steganography finding implies that a hidden route stays open, and nothing in the factorization papers rules this out. The "mask without channel" ablation, combined with our hidden-signal probe, measures directly how much defect information still passes through the template.
Why not just fuse a supervised segmenter with an unsupervised score? Late fusion is easy and strong on known types. The supervised half, however, gives no help on unseen types, and the unsupervised half keeps its thresholding problem. Our held-out-type protocol is designed to separate the two approaches. If late fusion matches us on unseen types, the single-mask design is not justified.
Why not just use saliency-guided diffusion like Dif-fuse? Its repainting depends on a classifier attending to the defect, which is exactly what fails for novel types. Iterative sampling also cannot reach the hundreds of frames per second that AL-CycleGAN achieves. Our method is a single forward pass at inference.
Proposed Experiments
Step 1: a diagnostic gate. On MCBT and the MVTec AD texture categories, we train the Kim and AL-CycleGAN pipelines. We then perturb the template with noise of 3/256 amplitude and with JPEG compression, and measure how much the cycle reconstruction error rises inside versus outside the defect regions. In parallel, we measure the high-frequency energy of the template inside defect regions, after adaptive histogram equalization as in Chu et al. We then correlate this hidden-signal strength with per-defect miss rate. If reconstruction is unaffected and hidden energy does not predict misses, the motivation fails, and we stop and report that negative result.
Step 2: the main comparison. We run on MCBT, all fifteen MVTec AD categories, and TILDA. Metrics are pixel-level AUROC, PRO, image-level AUROC, mIoU on TILDA, and frames per second.
Step 3: held-out defect types. For each MVTec AD category, some defect types are labeled and the remaining types are held out, rotated across folds. We report localization separately on seen and unseen types. Our claim predicts the largest margin over the supervised-only and late-fusion baselines on unseen types, with no loss on seen types.
Step 4: a stress test. We evaluate on the TILDA non-rigid textures, where pixel subtraction collapsed, to check whether the learned mask avoids raw-difference brittleness.
Step 5: an optional transfer arm. On BraTS 2018 and BraTS 2021, we would measure Dice against Dif-fuse's 0.699. We would also measure the identity score against the factorization method's 0.88 on BraTS 2018. This arm tests whether the mechanism carries over from factory surfaces to anatomy.
References
- CycleGAN, a Master of Steganography
- Weakly-Supervised Defect Segmentation on Periodic Textures Using CycleGAN
- When Textures Deceive: Weakly Supervised Industrial Anomaly Detection with Adapted-Loss CycleGAN
- Adversarial Pseudo Healthy Synthesis Needs Pathology Factorization
- Pseudo-healthy synthesis with pathology disentanglement and adversarial learning
- Diffusion Models for Counterfactual Generation and Anomaly Detection in Brain Images
- MVTec AD - A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection
- Semi-Supervised Isolation Forest for Anomaly Detection
- FusedVision: A Knowledge-Infusing Approach for Practical Anomaly Detection in Real-world Surveillance Videos