When a generative adversarial network (GAN), a generator trained against a "discriminator" network that tries to tell real images from generated ones, must learn from only about a hundred images of a rare industrial defect, it fails in two ways. First, it overfits: the discriminator memorizes the few real images. Second, the defect itself comes out blurry or smeared, because the discriminator shrinks the image through strided convolutions and pooling before deciding. An 8×8-pixel crack therefore reaches its decision layers as a fraction of one feature cell, and the generator gets almost no gradient about crack texture. The usual cure for overfitting is to augment the training images. In generative models, though, augmentations "leak": the generator copies the transformation, producing tilted faces, black boxes, or padded borders. The obvious cure for lost resolution would be to show the discriminator magnified views of the defect. That is an augmentation too, and a dangerous one.
This note proposes defect-anchored symmetric magnification. With some probability, the discriminator sees both real and generated images through the same differentiable "zoom" centered on the defect, at native or upsampled resolution. For real images, the zoom location comes from the annotation. For generated images, it comes from the defect mask the generator itself outputs. The new difficulty, and the scientific core of the work, is that this augmentation depends on the content. The generator decides where the camera points. Existing non-leaking guarantees assume an augmentation drawn independently of the image, so they no longer cover this case. We aim to give a non-leaking condition for content-anchored augmentations, build a sampler that satisfies it, and show that it recovers fine defect texture in few-shot defect synthesis without leaking zoom framing or mask–defect mismatch.
Core Claim
Fine detail in few-shot generative models is lost twice. The discriminator's downsampling hides it, and the scale augmentations that could expose it either miss tiny targets or leak. A symmetric, differentiable magnification anchored on a predicted defect location can solve both problems. It is non-leaking only under two conditions. The anchor distribution for fakes must be matched to that of reals. A residual of anchor-independent views (unaugmented and uniformly placed) must be kept, so the generator cannot game which region the discriminator inspects. We expect that dropping either condition produces a specific, measurable leak: defects drawn outside their own masks, or masks drawn without defects.
Where This Sits
The augmentation-leakage literature supplies the method. On Data Augmentation for GAN Training and Differentiable Augmentation for Data-Efficient GAN Training showed that applying the same differentiable transform to reals and fakes removes the generator's incentive to reproduce it. We reuse that symmetric structure. Training Generative Adversarial Networks with Limited Data (adaptive discriminator augmentation, ADA) stated the non-leaking condition: an augmentation distribution that is invertible as a whole, typically ensured by applying it with probability below one. ADA also gave a heuristic for tuning that probability. We reuse the heuristic. ADA's argument treats the transform as independent of the image, and that independence is exactly what our anchoring breaks.
Improving the Leaking of Augmentations in Data-Efficient GANs via Adaptive Negative Data Augmentation (ANDA) motivates the problem. It found that residual leakage persists at around 100 images even under these schemes, and it suppressed it by labeling corrupted images as fake. ANDA works with coarse spatial corruptions and never asks what the discriminator can resolve. We use ANDA as a competitor and as an optional add-on.
On the resolution side, three works establish that uniform downsampling destroys small targets regardless of depth. LIP: Local Importance-Based Pooling learns importance-weighted pooling and raises COCO small-object AP from 21.9% to 24.0%. Single Shot Multibox Detector With Deconvolutional Region Magnification Procedure and MSR-RCNN magnify or super-resolve shallow features of proposed regions. All three operate in discriminative detectors. We move region magnification out of the architecture and into the discriminator's input distribution, where its leakage consequences must be controlled.
ContextMix constrains the design in two ways. It shows that random crops and cutout routinely miss tiny defects, which is the argument against uniform zoom. Its downscale-and-paste operation is also a ready-made example of an augmentation we predict will leak if used naively in a GAN, as framed miniatures inside images.
The closest application work is Defect-GAN. It composes a generated defect foreground and a spatial map onto clean images and reaches FID 65.6 on the concrete-defect dataset CODEBRIM. Its compositional output is what gives us a generator-side anchor. Defect-GAN, however, uses no non-leaking augmentation and assumes enough data to avoid collapse. Alias-Free Generative Adversarial Networks leaves the discriminator's downsampling untouched by design. We treat that as further evidence that discriminator-side resolution is an open lever.
Research Program
The generator follows Defect-GAN's compositional design. It outputs a defect layer and a soft spatial mask, which are blended onto a clean background image. The discriminator is a standard StyleGAN2-style network.
At each step, with probability $p$, both real and fake images pass through a differentiable magnification. The image is resampled with a bandlimited filter onto a window of side $s$ (drawn from a range reaching down to native defect scale), centered at location $c$, and upsampled to discriminator input size. Gradients flow through the resampling and through $c$. With probability $1-p$, the image passes unaugmented. The ADA overfitting heuristic tunes $p$.
The anchor $c$ is drawn from a mixture, $c \sim \lambda\, q(c \mid m) + (1-\lambda)\, \mathrm{Uniform}$. Here $m$ is the defect mask (annotated for reals, generated for fakes), $q$ samples mask-weighted positions with jitter, and $\lambda$ is the fraction of anchored views.
The analysis asks when this content-dependent augmentation is non-leaking. Our working hypothesis has two parts. The uniform component, together with the unaugmented branch, keeps the overall transform invertible in ADA's sense. Requiring that the conditional distribution of anchored crops given the mask match between reals and fakes closes the gap the generator could otherwise exploit, namely painting texture outside its own mask, where the zoom rarely looks. We will derive this condition, then test it by deliberately breaking each part. One test sets the uniform weight to zero ($\lambda=1$). Another uses mismatched anchor jitter between reals and fakes. A third detaches gradients through $c$.
As a negative control, we add ContextMix-style downscale-and-paste to the same pipeline and measure the predicted leakage of framed miniatures. This establishes that scale augmentations do leak in this regime and that symmetry alone is not the whole story.
Baselines
The naive reference is StyleGAN2 with no augmentation on the same few-shot defect subsets. It should overfit and blur, and it anchors every other number.
The main established competitor is StyleGAN2 with ADA, and separately with DiffAugment's translation, cutout, and color policy, including its zoom/crop variant. These are the standard non-leaking pipelines, so any gain must exceed them. The strongest reported few-shot number in the file is ANDA's: on FFHQ-100, adding ANDA to StyleGAN2 + ADA lowers FID from 82.17 to 71.42 (ANDA). On Obama 100-shot, adding ANDA to Diffusion-GAN lowers FID from 28.55 to 26.40. We will run StyleGAN2 + ADA + ANDA ourselves on our defect subsets.
For defect synthesis, the domain reference is Defect-GAN, with CODEBRIM FID 65.6 and downstream ResNet34 accuracy improving from 70.25% to 75.48%. Those numbers are full-data. No reported result was found on Lacuna for Defect-GAN in a 100-image regime, so we will rerun it at matched data sizes.
The architectural competitor replaces the discriminator's pooling and strided downsampling with LIP. This tests whether keeping detail inside the network suffices without any augmentation.
The most important ablation pits uniform-position magnification at the same zoom scales ($\lambda=0$) against anchored magnification. It isolates whether pointing the zoom at the defect is what matters.
For fairness, every method uses the same generator, the same discriminator backbone, and the same images. All get an equal training budget in images shown to the discriminator and an equal hyperparameter search budget (the same number of runs over learning rate, $p$-target, and method-specific weights). Each is reported over at least three seeds. Beating the field means two things together. Anchored magnification must lower defect-crop FID clearly below ADA + ANDA and LIP across seeds, with whole-image FID no worse. It must also pass the leakage checks below.
Why not just…?
Why not just add a second discriminator that looks only at high-resolution patches? This is the most serious threat. A local patch discriminator on defect crops could deliver most of the benefit. The difference is that a separate patch critic always sees crops, so the crop distribution is never mixed with full views. By ADA's own reasoning, that mixing is what prevents leakage. A separate critic on generator-anchored crops is exactly the $\lambda=1$, no-unaugmented-view setting, where we predict out-of-mask texture. We will run a two-discriminator baseline with both annotation-anchored and uniform patches at matched parameter count. If it matches our method on both quality and leakage, the contribution narrows to the analysis, and we will say so.
Why not just use DiffAugment's random crop and zoom? Uniform crops at defect scale mostly land on background. ContextMix documents this "missing object" failure for cutout and CutMix. The $\lambda=0$ ablation measures it directly: if uniform zoom matches anchored zoom on defect-crop FID, anchoring is unnecessary.
Why not just fix the discriminator's downsampling with LIP or alias-free filters? LIP shows content-aware pooling preserves small objects in detectors. It does nothing about overfitting, though, and a sharper discriminator may memorize 100 images faster. We test LIP alone and LIP combined with our method. If LIP alone closes the defect-crop gap, the augmentation is redundant.
Why not just add negative augmentation as in ANDA? ANDA penalizes known artifacts but does not give the discriminator more resolution on the defect. It is complementary, and we report it both as a baseline and stacked with our method.
Proposed Experiments and Decisive Checks
The primary benchmark is CODEBRIM, reduced to 100 and 300 defect images per class with its annotated regions. To test generality beyond defects, we add a controlled probe: FFHQ-100 and Obama 100-shot with small synthetic high-frequency marks planted at known locations, which give exact masks and ground-truth texture.
We report whole-image FID, plus FID computed only on native-resolution crops around defects. We also measure high-frequency spectral energy inside defect regions relative to real defects, which directly quantifies blur. Downstream, we train a ResNet34 classifier on real plus synthetic CODEBRIM data, following Defect-GAN's protocol.
Leakage is measured three ways. A classifier trained to detect zoom framing or pasted miniatures is applied to generated samples. A mask–texture mismatch rate counts how much high-frequency defect energy falls outside the generated mask. A mask-without-defect rate counts masks that contain no defect texture.
The decisive checks are these. Anchored magnification must improve defect-crop FID and in-mask spectral energy over ADA + ANDA, LIP, and uniform zoom without raising any leakage rate. Setting $\lambda=1$, or removing the unaugmented branch, must produce the predicted rise in out-of-mask texture. The ContextMix-style negative control must leak framed miniatures. If anchoring helps quality but the broken-condition runs do not leak, our non-leaking analysis is wrong and must be revised. If the two-discriminator baseline matches us on every axis, the method collapses into it.
References
- On Data Augmentation for GAN Training
- Differentiable Augmentation for Data-Efficient GAN Training
- Training Generative Adversarial Networks with Limited Data
- Improving the Leaking of Augmentations in Data-Efficient GANs via Adaptive Negative Data Augmentation
- LIP: Local Importance-Based Pooling
- Single Shot Multibox Detector With Deconvolutional Region Magnification Procedure
- MSR-RCNN: A Multi-Class Crop Pest Detection Network Based on a Multi-Scale Super-Resolution Feature Enhancement Module
- ContextMix: A context-aware data augmentation method for industrial visual inspection systems
- Defect-GAN: High-Fidelity Defect Synthesis for Automated Defect Inspection
- Alias-Free Generative Adversarial Networks